package org.obs.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.obs.domain.ext.Markable;

@Entity
@Table(name = "BLOG_ENTRY")
public class BlogEntry extends Entry implements Serializable, Markable {

	private static final long serialVersionUID = 1L;

	@ManyToOne(fetch=FetchType.LAZY, optional = false)
	private Blog blog;
	
	@ManyToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
	private Set<Mark> marks;

	public Blog getBlog() {
		return blog;
	}

	public void setBlog(Blog blog) {
		this.blog = blog;
	}

	public Set<Mark> getMarks() {
		if (this.marks == null) {
			this.marks = new HashSet<Mark>();
		}
		return this.marks;
	}

	public void setMarks(Set<Mark> marks) {
		this.marks = marks;
	}
}
